import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
// import Detail from '../views/detail.vue'

const Renwu = () => import(/*webpackChunkName:'Renwu'*/'../views/renwu/index.vue')

const List = () => import(/*webpackChunkName:'error'*/'../views/List.vue')
const Detail = () => import(/*webpackChunkName: 'detail'*/ '../views/detail.vue')
const Error = () => import(/*webpackChunkName:'error'*/'../views/404')

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Renwu,
    name: 'Renwu',
    meta: {
      title: '任务管理'
    }
  },
  {
    path: '/detail',
    component : Detail,
    name: 'detail'
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  },
  {
    path: "*",
    component: Error
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
